package com.wx.web;

import com.wx.api.utils.SpringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.core.env.Environment;

/**
 * @author liaogui
 */

@SpringBootApplication
@ComponentScan("com.wx")
public class WxWebApplication {
    public static final Logger logger = LoggerFactory.getLogger(WxWebApplication.class);

    private static Environment environment;
    // setter 注入
    public static Environment getEnvironment() {
        return environment;
    }
    @Autowired
    public void setEnvironment(Environment environment) {
        WxWebApplication.environment = environment;
    }

    public static void main(String[] args) {
        SpringApplication.run(WxWebApplication.class, args);
        String property = environment.getProperty("server.port");
        logger.info("swagger-ui:http://localhost:{}/swagger-ui.html#/wx-pay-controller", property);
        Object wxPayService = SpringUtil.getBean("wxPayService");

    }
}
